//导入 mongoose
const mongoose = require('mongoose');

//导入 db
const db = require('./db/db');

//导入模型
const MovieModel = require('./models/MovieModel');
const CarModel = require('./models/CarModel');

//调用函数
db(()=>{
  //读取集合的数据
  // MovieModel.find((err, data) => {
  //   if(err) throw err;
  //   console.log(data);
  // })

  //插入汽车的文档数据
  CarModel.create({
    brand: '华为问界',
    price: 300000,
    type: '混动'
  }, (err, data) => {
    if(err) throw err;
    console.log(data);
  })
}, ()=>{
  console.log('连接失败啦~~');
})